package com.overlays;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Point;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.widget.Toast;

import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapView;
import com.google.android.maps.Overlay;

public class AddWaypoint extends Overlay{
    
    BitmapDrawable bmp;
    static int w, h;
    Point p;
    private Context context;
    
    public AddWaypoint(Drawable d, Point p, Context _context) { 
	context = _context;
	bmp = (BitmapDrawable) d; 
	this.p = p; 
	w = bmp.getIntrinsicWidth(); 
	h = bmp.getIntrinsicHeight(); 
    } 
    
    @Override
    public void draw(Canvas canvas, MapView mapView, boolean shadow) {
	bmp.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
	bmp.setAlpha(100);
	bmp.draw(canvas);
    }

    @Override
    public boolean onTap(GeoPoint p, MapView mapView) {
	Toast.makeText(context, p.toString(), Toast.LENGTH_SHORT).show();
	return true;
    }

}
